package week6;

class CPU {
    private int speed;
    public int getSpeed(){
        return speed;
    }
    public void setSpeed(int speed){
        this.speed=speed;
    }
}
class HardDisk{
    private int amount;
    public int getAmount(){
        return amount;
    }
    public void setAmount(int amount){
        this.amount=amount;
    }
}
class PC{
    private CPU cpu;
    private HardDisk hd;
    public void setCPU(CPU cpu){
        this.cpu=cpu;
    }
    public void setHardDisk(HardDisk hardDisk){
        this.hd=hardDisk;
    }
    public void show(){
        System.out.println("CPU速度:"+cpu.getSpeed()+"MHz,硬盘容量："+hd.getAmount()+"GB");
    }
}
public class Test{
    public static void main(String[] args){
        CPU cpu =new CPU();
        cpu.setSpeed(2200);
        HardDisk disk=new HardDisk();
        disk.setAmount(200);
        PC pc=new PC();
        pc.setCPU(cpu);
        pc.setHardDisk(disk);
        pc.show();
    }
}
